package com.lagou.ipersistence.scripting.xmltags;

import com.lagou.ipersistence.builder.BaseBuilder;
import com.lagou.ipersistence.mapping.SqlSource;
import com.lagou.ipersistence.parsing.XNode;
import com.lagou.ipersistence.scripting.defaults.RawSqlSource;
import com.lagou.ipersistence.session.Configuration;

/**
 * @author Yan Jiahong
 * Created on 2020/11/18
 */
public class XMLScriptBuilder extends BaseBuilder {
    private final XNode context;

    private final boolean isDynamic = false;

    private final Class<?> parameterType;

    public XMLScriptBuilder(Configuration configuration, XNode context, Class<?> parameterType) {
        super(configuration);
        this.context = context;
        this.parameterType = parameterType;
    }

    public SqlSource parseScriptNode() {
        String sql = context.text();
        return new RawSqlSource(configuration, sql, parameterType);
    }
}
